<?php if(!defined('BASEPATH')) exit('No direct script allowed');

class mdl_jenis_kendaraan extends CI_Model{
	
	function __construct()
	{
		parent::__construct();
	}
	
	function getItem($num=0, $offset=0)
	{		if(!$num){$num=0;}		if(!$offset){$offset=0;}		/*
		$this->db->flush_cache();
		$this->db->select('t_jeniskb.*');
		$this->db->from('t_jeniskb');  
		$this->db->order_by("kode", "asc");
		$this->db->limit($offset, $num); 		return $this->db->get();		*/ 						$sql = "select skip $offset first $num * 				from t_jeniskb				order by kode asc				"; 				$this->db->flush_cache();		return $this->db->query($sql);				}
	
	function getItemById($kode)
	{
		$this->db->flush_cache();
		$this->db->select('t_jeniskb.*');
		$this->db->from('t_jeniskb');
		$this->db->where('t_jeniskb.kode', $kode);
		return $this->db->get();
	}

	function insert($data)
	{
		$this->db->flush_cache();
		$this->db->insert('t_jeniskb', $data);
	}
	
	function update($kode, $data)
	{
		$this->db->flush_cache();
		$this->db->where('kode', $kode);
		$this->db->update('t_jeniskb', $data);
	}
	
	function delete($kode)
	{
		$this->db->flush_cache();
		$this->db->delete('t_jeniskb', array('kode' => $kode));		
	}
		function getAll()	{		$this->db->flush_cache();		$this->db->select('t_jeniskb.*');		$this->db->from('t_jeniskb');  		$this->db->order_by("kode", "asc"); 		return $this->db->get();		}  
}